package org.dalmatian.app.system.listener.event;

import org.dalmatian.app.system.service.ISysOperLogService;
import org.dalmatian.common.core.domain.OperLogEvent;
import org.dalmatian.common.core.utils.MapstructUtils;
import org.dalmatian.app.system.domain.bo.SysOperLogBo;
import org.noear.solon.annotation.Component;
import org.noear.solon.annotation.Inject;
import org.noear.solon.core.event.EventListener;

@Component
public class OperLogEventListener implements EventListener<OperLogEvent> {
    @Inject
    ISysOperLogService sysOperLogService;

    @Override
    public void onEvent(OperLogEvent operLogEvent) throws Throwable {
        SysOperLogBo operLog = MapstructUtils.convert(operLogEvent, SysOperLogBo.class);
        sysOperLogService.insertOperlog(operLog);
    }
}
